<?php

class Pictures_Image_DisplayPreviewSuccessView extends BlogPicturesBaseView
{
    /**
     * Display image preview (thumbnail e.g.)
     *
     * @param AgaviRequestDataHolder $rd
     */
	public function executeImage(AgaviRequestDataHolder $rd)
	{
	    /* @var $model Pictures_PicturesModel */
	    $model = $this->getContext()->getModel('Pictures', 'Pictures');
	    $picture = $this->getAttribute('picture');
	    $size = $rd->getParameter('size');
        try {
           list($content_type, $data, $last_modified) = $model->getPictureData($picture, $size);
        } catch (WereWordException $e) {
            $this->setRoutingRedirect('no_image_box');
            return '';
        }
	    $this->getResponse()->setContentType($content_type);
	    $this->getResponse()->setHttpHeader('Last-Modified', gmdate(DATE_RFC822, $last_modified));
	    
	    return $data;
	}
}

?>